// 定义转换组件
export const convertDataList: DataItem[] = [
  {
    label: '默认值',
    path: 'addDefault',
    image: '/src/assets/icons/flow//information_add.svg',
  },
  {
    label: '基本运算',
    path: 'basicOperations',
    image: '/src/assets/icons/flow/calculator.svg',
  },
  {
    label: '脚本转换',
    path: 'conversionScript',
    image: '/src/assets/icons/flow//script.svg',
  },
  {
    label: '合并/拆分',
    path: 'mergeSplit',
    image: '/src/assets/icons/flow//merge.svg',
  },
  {
    label: '数字类型',
    path: 'numberType',
    image: '/src/assets/icons/flow//script_1.svg',
  },
  {
    label: '简单过滤',
    path: 'simpleFiltering',
    image: '/src/assets/icons/flow//filter-records-fill.svg',
  },
  {
    label: '时间格式',
    path: 'timeConversion',
    image: '/src/assets/icons/flow//Date_time.svg',
  },
];

// 定义输出组件
export const outputDataList: DataItem[] = [
  {
    label: '控制台',
    path: 'consoleOutput',
    image: '/src/assets/icons/flow//console.svg',
  },
  {
    label: 'Kafka',
    path: 'kafkaOutput',
    image: '/src/assets/icons/flow//Kafka_1.svg',
  },
  {
    label: 'mongodb',
    path: 'mongoDbOutput',
    image: '/src/assets/icons/flow//mongo.svg',
  },
  {
    label: '表输出',
    path: 'tableOut',
    image: '/src/assets/icons/flow//database.svg',
  },
];

// 定义输入组件
export const inputDataList: DataItem[] = [
  {
    label: 'Excel',
    path: 'Excel',
    image: '/src/assets/icons/flow//file-excel.svg',
  },
  {
    label: 'CSV',
    path: 'CSV',
    image: '/src/assets/icons/flow//CSV.svg',
  },
  {
    label: 'JSON',
    path: 'JSON',
    image: '/src/assets/icons/flow//json_1.svg',
  },
  {
    label: 'Kafka',
    path: 'Kafka',
    image: '/src/assets/icons/flow//Kafka_1.svg',
  },
  {
    label: 'mongodb',
    path: 'mongodb',
    image: '/src/assets/icons/flow//mongo.svg',
  },
  {
    label: '表输入',
    path: 'outside',
    image: '/src/assets/icons/flow//table-in.svg',
  },
];

export interface DataItem {
  label: string;
  path: string;
  image: string;
}

// 定义连接桩属性 （节点上的固定连接点）
export const ports = {
  groups: {
    top: {
      position: 'top',
      attrs: {
        circle: {
          r: 4,
          magnet: true,
          stroke: '#5F95FF',
          strokeWidth: 1,
          fill: '#fff',
          style: {
            visibility: 'hidden',
          },
        },
      },
    },
    right: {
      position: 'right',
      attrs: {
        circle: {
          r: 4,
          magnet: true,
          stroke: '#5F95FF',
          strokeWidth: 1,
          fill: '#fff',
          style: {
            visibility: 'hidden',
          },
        },
      },
    },
    bottom: {
      position: 'bottom',
      attrs: {
        circle: {
          r: 4,
          magnet: true,
          stroke: '#5F95FF',
          strokeWidth: 1,
          fill: '#fff',
          style: {
            visibility: 'hidden',
          },
        },
      },
    },
    left: {
      position: 'left',
      attrs: {
        circle: {
          r: 4,
          magnet: true,
          stroke: '#5F95FF',
          strokeWidth: 1,
          fill: '#fff',
          style: {
            visibility: 'hidden',
          },
        },
      },
    },
  },
  items: [
    {
      group: 'top',
    },
    {
      group: 'right',
    },
    {
      group: 'bottom',
    },
    {
      group: 'left',
    },
  ],
};

export const customFlowJson = {
  nodes: [
    {
      x: 170,
      y: 190,
      visible: true,
      shape: 'custom-rect-image',
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//file-excel.svg',
        },
      },
      ports: {
        items: [
          {
            group: 'right',
            id: 'bbe25c59-e7a4-4bd2-8a9e-46a9db6b7c49',
          },
          {
            group: 'left',
            id: 'd04eadc3-3bee-40b4-a9a5-e09a744c5742',
          },
        ],
      },
      label: 'Excel',
      id: 'cd0ab310-91dc-4130-88c1-2bef43fa8749',
      data: 'Excel',
      zIndex: 1,
    },
    {
      x: 170,
      y: 290,
      visible: true,
      shape: 'custom-rect-image',
      label: 'CSV',
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//CSV.svg',
        },
      },
      ports: {
        items: [
          {
            group: 'right',
            id: '5cef9da8-f36e-4d15-a649-aabdf78f5c8a',
          },
          {
            group: 'left',
            id: '552787ea-5970-47dd-91da-564b63507e6a',
          },
        ],
      },
      id: '4fea0aba-4eff-47fd-bc6c-aa7ef917d58f',
      data: 'CSV',
      zIndex: 2,
    },
    {
      x: 417,
      y: 230,
      visible: true,
      shape: 'custom-rect-image',
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//merge.svg',
        },
      },
      ports: {
        items: [
          {
            group: 'right',
            id: '7e10988f-6cda-4d77-8461-1c6460b48722',
          },
          {
            group: 'left',
            id: '6d3e9860-974d-40fd-95bb-629efc4e371b',
          },
        ],
      },
      label: '合并/拆分',
      id: '9d3306f9-52a1-4191-936e-4fc56dfba1c4',
      data: 'mergeSplit',
      zIndex: 4,
    },
    {
      x: 628,
      y: 230,
      visible: true,
      shape: 'custom-rect-image',
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//filter-records-fill.svg',
        },
      },
      ports: {
        items: [
          {
            group: 'right',
            id: '7b660666-b25e-44af-ac93-211ca80a8cf3',
          },
          {
            group: 'left',
            id: 'f750bf63-b225-453d-b667-4a5588d3353a',
          },
        ],
      },
      label: '简单过滤',
      id: '5613a3f9-4061-46d1-ac5f-9c9ab2529de0',
      data: 'simpleFiltering',
      zIndex: 5,
    },
    {
      x: 832,
      y: 230,
      visible: true,
      shape: 'custom-rect-image',
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//script.svg',
        },
      },
      ports: {
        items: [
          {
            group: 'right',
            id: '64503e84-998f-4cc2-a0e3-b1953e9e2bd5',
          },
          {
            group: 'left',
            id: '16167860-7471-4141-b20d-fc10143601a8',
          },
        ],
      },
      label: '脚本转换',
      id: 'feb1d48f-e9d8-4a54-8721-b16b0ca2a5ff',
      data: 'conversionScript',
      zIndex: 6,
    },
    {
      x: 1049,
      y: 230,
      visible: true,
      attrs: {
        image: {
          'xlink:href': '/src/assets/icons/flow//database.svg',
        },
      },
      shape: 'custom-rect-image',
      ports: {
        items: [
          {
            group: 'right',
            id: 'fce15a60-b873-4182-8a90-b56bb17e0db9',
          },
          {
            group: 'left',
            id: 'c4ab237f-3d05-4991-897b-03e1cecc699f',
          },
        ],
      },
      label: '表输出',
      id: '0e08ab74-bf19-497b-91e7-ac17130b4b2c',
      data: 'tableOut',
      zIndex: 7,
    },
  ],
  edges: [
    {
      shape: 'edge',
      attrs: {
        line: {
          stroke: '#2d9ad5',
        },
      },
      id: '3d739176-3670-4e21-8a22-192f91989315',
      zIndex: 0,
      source: {
        cell: 'cd0ab310-91dc-4130-88c1-2bef43fa8749',
        port: 'bbe25c59-e7a4-4bd2-8a9e-46a9db6b7c49',
      },
      target: {
        cell: '9d3306f9-52a1-4191-936e-4fc56dfba1c4',
        port: '6d3e9860-974d-40fd-95bb-629efc4e371b',
      },
    },
    {
      shape: 'edge',
      id: '7ccd366c-0c50-4ebe-bc29-c4091d52042c',
      zIndex: 0,
      source: {
        cell: '4fea0aba-4eff-47fd-bc6c-aa7ef917d58f',
        port: '5cef9da8-f36e-4d15-a649-aabdf78f5c8a',
      },
      target: {
        cell: '9d3306f9-52a1-4191-936e-4fc56dfba1c4',
        port: '6d3e9860-974d-40fd-95bb-629efc4e371b',
      },
    },
    {
      shape: 'edge',
      id: 'd2de4fdf-d43e-497d-8e14-c5b7dcae2acf',
      zIndex: 0,
      source: {
        cell: '9d3306f9-52a1-4191-936e-4fc56dfba1c4',
        port: '7e10988f-6cda-4d77-8461-1c6460b48722',
      },
      target: {
        cell: '5613a3f9-4061-46d1-ac5f-9c9ab2529de0',
        port: 'f750bf63-b225-453d-b667-4a5588d3353a',
      },
    },
    {
      shape: 'edge',
      id: '5c79b07b-a7f0-4786-84da-8d8726970f7c',
      zIndex: 0,
      source: {
        cell: '5613a3f9-4061-46d1-ac5f-9c9ab2529de0',
        port: '7b660666-b25e-44af-ac93-211ca80a8cf3',
      },
      target: {
        cell: 'feb1d48f-e9d8-4a54-8721-b16b0ca2a5ff',
        port: '16167860-7471-4141-b20d-fc10143601a8',
      },
    },
    {
      shape: 'edge',
      id: '52bbfe93-261c-48cb-8d00-c47c0baef6e5',
      zIndex: 0,
      source: {
        cell: 'feb1d48f-e9d8-4a54-8721-b16b0ca2a5ff',
        port: '64503e84-998f-4cc2-a0e3-b1953e9e2bd5',
      },
      target: {
        cell: '0e08ab74-bf19-497b-91e7-ac17130b4b2c',
        port: 'c4ab237f-3d05-4991-897b-03e1cecc699f',
      },
    },
  ],
};
